package com.mangowang.module.main;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mangowang.lib.component.service.IAccountService;

@Route(path = "/main/MainActivity")
public class MainActivity extends AppCompatActivity {

    //发送方和接收方定义的key名称相同则无需处理
//    @Autowired
//    public String url;
//    //通过name来映射URL中的不同参数
//    //发送方定义key为content，我们用title来接收
    @Autowired(name = "content")
    public String title;


    @Autowired
    IAccountService accountService;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ARouter.getInstance().inject(this);
//        注入参数和服务(这里用到@Autowired所以要设置)
        //不使用自动注入,可不写，如CollectActivity没接收参数就没有设置
       TextView textView = findViewById(R.id.tv_test);
//       textView.setText(String.format("%s,你来啦", title));
        textView.setText(accountService.getAccountId());
    }
}